#include "TBRdynLinkLibManager.h"

#ifdef _WINDOWS_

#endif // _WINDOWS_

using namespace TBR;

TBRdynLinkLib::TBRdynLinkLib(const char *name)
{
	dynLinkName = std::string(name);
	hdll = NULL;

}

TBRdynLinkLib::~TBRdynLinkLib()
{
	unload();
}






///////////////////////TBR dynLinkLib Manager////////////////////


TBRdynLinkLib* TBRdynLinkLibManager::dynLinkLoad(char * name)
{
	TBRdynLinkLib *dynlink = new TBRdynLinkLib(name);
	const std::string str = std::string(name);
	dynLinkLibList.insert(std::pair<const std::string, TBRdynLinkLib*>(str, dynlink));

	return dynlink;
}

void TBRdynLinkLibManager::dynLinkUnLoad(TBRdynLinkLib*  lib)
{

	std::map<const std::string, TBRdynLinkLib*>::iterator it=NULL;
	it = dynLinkLibList.find(lib->getName());
	dynLinkLibList.erase(it);

	lib->unload();
}



